﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Web.UI.HtmlControls;
public partial class Guest_Gallery : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string imagePath = "Gallery/Image";
        string thumbnailPath = "Gallery/Thumbnails";
        DirectoryInfo directory = new DirectoryInfo(Server.MapPath(imagePath));
        FileInfo[] files = directory.GetFiles();
        string control = string.Empty;
        for (int i = 0; i < files.Length; i++)
        {

            /*<div>
						<ul>
							<li>
								<a href="living-room.html"><img src="images/project-gallery1.jpg" alt=""></a> <span><a href="living-room.html">Purple Hues Modern Living Room</a></span>
							</li>

             * */
            control += string.Format(@"<li> <a class=""vlightbox6"" href=""{2}/{1}"" title=""Image{3}""><img src=""{0}/{1}"" alt=""Image{3}""/></a> <span> <a> </a></span>", thumbnailPath, files[i].Name.ToString(),imagePath, i + 1);
        }
        if (control != string.Empty)
        {
            string divString = string.Format(@"<ul> {0} </ul>", control);
            HtmlGenericControl div = new HtmlGenericControl();
            div.ID = "containDiv";            
            div.InnerHtml = divString;
            galleryDiv.Controls.Add(div);
        }
    }
}